<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/js/elementui/index.css">
    <script src="/js/vue/vue.js"></script>
    <script src="/js/axios/axios.min.js"></script>
    <script src="/js/qs/qs.min.js"></script>
    <script src="/js/elementui/index.js"></script>
</head>
<body>
<div id="app">


    <template >
        <el-image
                style="width: 100px; height: 100px"
                :src="product.productImg"
                :fit="fit"></el-image>
        <br>
        <span>好品质好价格，呈现真实的美!电池，网上购物就选JD，多仓直发 极速配送</span><br>
        <span>规格:{{product.productPrice}}元/个</span><br>
        <span>重量:80kg</span><br>
        <span>价格:￥{{product.productPrice}}</span><br>
        <span> 状态:</span>
            <el-tag v-if="sumKc > 0" type="success">有货</el-tag>
            <el-tag else type="danger">缺货</el-tag>
        <br>
        <span>物品名称:{{product.productName}}</span><br>
        <span>产品编号:{{product.productNumber}}</span><br>
        <span>数量:{{sumKc}}</span><br>
        <span>产品颜色:黑色</span><br>
        <span>库存:{{sumKc}}</span><br>
        <span>月销量:{{sumXl}}</span><br>
        <span>金额:{{product.productPrice}}</span><br>
        <span>所属分类:{{product.categories.name}}</span><br>
        <span>会员价:{{product.productPrice}}</span><br>
        <span>总价:{{product.productPrice}}</span><br>
        <span></span>

    </template>
    <el-button type="primary" @click="returnProduct" >返回</el-button>

</div>
</body>
<script>
    new Vue({
        el:"#app",
        data(){
            return {
                product:{
                    id:'',
                    productNumber:'',
                    productName: '',
                    productImg:'',
                    productKind:'',
                    productQuality:'',              //商品质量
                    productCostPrice: '',
                    productPrice: '',
                    productIntegral:'',
                    productEnterprise:'',
                    productApplyStatus:'',          //审核状态
                    productStatus:'',               //商品状态
                    productRemarks:'',              //备注
                    companyId:'',
                    categories:'',                  //分类信息
                    company:''                      //公司信息
                },
                sumKc:'',
                sumXl:''
            }
        },
        methods:{
            logData(){
                axios.get("/productOneById").then(value => {
                    if (value.data.code==1){
                        this.product=value.data.data;
                        this.selectSum();
                    }
                })
            },
            selectSum(){
                axios.get("/product/cargo/"+this.product.productNumber).then(value => {
                    if (value.data.code==1){
                        this.sumKc=value.data.data;
                    }
                });
                axios.get("").then(value => {
                    if (value.data.code==1){
                        this.sumXl=value.data.data;
                    }
                })
            },
            returnProduct(){
                location.href="";
            }
        },
        mounted(){
            this.logData();
        }
    })
</script>
</html>